//
//  APListViewSection_VM_Protocol.swift
//  APSwift
//
//  Created by jianbo.pei on 2023/3/30.
//

import Foundation

class APListViewSection_TempVM {
    fileprivate var datas: [Any]? = nil
    fileprivate var headerModel: APReuseView_M_Protocol? = nil
    fileprivate var footerModel: APReuseView_M_Protocol? = nil
}

protocol APListViewSection_VM_Protocol {
    /// ⭐️⭐️⭐️⭐️⭐️
    /// 参考链接：
    /// 1、[Swift中协议{ get }和{ get set }属性的区别](https://juejin.cn/post/6844903825057251335)
    /// 2、[协议中的私有属性](https://swift.gg/2019/02/18/protocols-private-properties/)
    /// ⭐️⭐️⭐️⭐️⭐️
    var tempVM: APListViewSection_TempVM { get }
    
    /// 分区（section）的数据源【即：section里的rows的数据源】
    var datas: [Any]? { get set }
    var headerModel: APReuseView_M_Protocol? { get set }
    var footerModel: APReuseView_M_Protocol? { get set }
}

extension APListViewSection_VM_Protocol {
    var datas: [Any]? {
        get { tempVM.datas }
        set { tempVM.datas = newValue}
    }
    var headerModel: APReuseView_M_Protocol? {
        get { tempVM.headerModel }
        set { tempVM.headerModel = newValue }
    }
    var footerModel: APReuseView_M_Protocol? {
        get { tempVM.footerModel }
        set { tempVM.footerModel = newValue }
    }
}
